@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row clear fontSize14">
    	<p class="col-xs-12">
    	<img src="{{ asset('images/surePay.png') }}" alt="活动发起" width="18" height="18" class="mr01">确认订单支付</p>
    	<form action="#" role="form">
    		<div class=" col-xs-12 bgWhite">
    			<p class="liHeight"><span class="text-left col-xs-5">交易单号</span><span class="text-right col-xs-7 colorGray">{{ $order->out_trade_no }}</span></p>
    			<p class="liHeight"><span class="text-left col-xs-5">活动名称</span><span class="text-right col-xs-7 colorGray">{{ $activity->name }}</span></p>
    			<p class="liHeight"><span class="text-left col-xs-5">开始时间</span><span class="text-right col-xs-7 colorGray">{{ date('Y-m-d H:i:s',$activity->start_time) }}</span></p>
                <p class="liHeight"><span class="text-left col-xs-5">开始时间</span><span class="text-right col-xs-7 colorGray">{{ date('Y-m-d H:i:s',$activity->end_time) }}</span></p>
    			<p class="liHeight"><span class="text-left col-xs-5">股票代码</span><span class="text-right col-xs-7 colorGray">{{ $order->stock_code }}</span></p>
				<p class="liHeight"><span class="text-left col-xs-5">股票名称</span><span class="text-right col-xs-7 colorGray">{{ $order->stock_name }}</span></p>
				<p class="liHeight"><span class="text-left col-xs-5">参与金额</span><span class="text-right col-xs-7" style="color: #d43f3a;" id="money">{{$activity->money}}</span></p>
    		</div>
    	</form>
    	<p class="col-xs-12 textAlign pleRig mtop"><button id="pay" type="button" class="btn btn-danger btn-pay">支付</button></p>
    </div>
	
</div>
<script type="text/javascript">
	$(function(){
		$("#pay").click(function(){

            $("#pay").attr("disabled",true);
            $('#pay').css('background','#999');

			var money=$("#money").text();
			var id='{{$order->id}}';
			console.log(money);
			console.log(id);
			$.ajax({
				type:'post',
				url:"{{url('pay')}}",
				data:{id:id,money:money},
				success:function(data){
					alert(data.msg);
					if(data.status==0){
						window.location.href="{{url('show_activity')}}/"+data.id;
					}
				}
			})
		})
	})
</script>
@endsection
